/*
 * =====================================================================================
 *
 *       Filename:  Log.cc
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  08/20/21 19:56:24
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  XXXXXXX (), XXXX@jd.com
 *        Company:  JDAI
 *        Copyright:  Copyright 2021, XXXXXXX
 *
 * =====================================================================================
 */
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <time.h>
#include <stdio.h>

#include "Log.h"

#define LOG_BUF_LEN  (128)

Log::Log() {
}

Log::~Log() {
}

bool Log::Init(char* conf) {
    conf = NULL;
    return true;
}

void Log::Print(int level, char const* fmt, const char* file, const char* func, const int line, ...) {
    char logBuf[LOG_BUF_LEN];
    char logBuf2[LOG_BUF_LEN];
    va_list args;
    time_t timep;
    timep = time(NULL);
    level = 0;
    va_start(args, fmt);
    vsnprintf(logBuf, LOG_BUF_LEN - 1, fmt, args);
    snprintf(logBuf2, LOG_BUF_LEN - 1, "%s %s %d : %s", file, func, line, logBuf);
    va_end(args);
    printf("%s\n", logBuf2);
}
